web.dev LIVE is now over! Head to web.dev/live to watch all the sessions, see top Q&A, and more.

Get Started with Remote Debugging Android Devices

Remote debug live content on an Android device from your Windows, Mac, or Linux computer. This tutorial teaches you how to:

  • Set up your Android device for remote debugging, and discover it from your development machine.
  • Inspect and debug live content on your Android device from your development machine.
  • Screencast content from your Android device onto a DevTools instance on your development machine.
Remote Debugging lets you inspect a page running on an Android device from
            your development machine.
Figure 1. Remote Debugging lets you inspect a page running on an Android device from your development machine.

Step 1: Discover your Android device

The workflow below works for most users. See Troubleshooting: DevTools is not detecting the Android device for more help.

  1. Open the Developer Options screen on your Android. See Configure On-Device Developer Options.
  2. Select Enable USB Debugging.
  3. On your development machine, open Chrome.
  4. Open DevTools.
  5. In DevTools, click the Main Menu Main Menu then select More tools > Remote devices.

    Opening the Remote Devices tab via the Main Menu.
    Figure 2. Opening the Remote Devices tab via the Main Menu

  6. In DevTools, open the Settings tab.

  7. Make sure that the Discover USB devices checkbox is enabled.

    The Discover USB Devices checkbox is
       enabled.
    Figure 3. The Discover USB Devices checkbox is enabled

  8. Connect your Android device directly to your development machine using a USB cable. The first time you do this, you usually see that DevTools has detected an unknown device. If you see a green dot and the text Connected below the model name of your Android device, then DevTools has successfully established the connection to your device. Continue to Step 2.

    The Remote Devices tab has successfully detected
       an unknown device that is pending authorization.
    Figure 4. The Remote Devices tab has successfully detected an unknown device that is pending authorization

  9. If your device is showing up as Unknown, accept the Allow USB Debugging permission prompt on your Android device.

Troubleshooting: DevTools is not detecting the Android device

Make sure that your hardware is set up correctly:

  • If you're using a USB hub, try connecting your Android device directly to your development machine instead.
  • Try unplugging the USB cable between your Android device and development machine, and then plugging it back in. Do it while your Android and development machine screens are unlocked.
  • Make sure that your USB cable works. You should be able to inspect files on your Android device from your development machine.

Make sure that your software is set up correctly:

If you don't see the Allow USB Debugging prompt on your Android device try:

  • Disconnecting and then re-connecting the USB cable while DevTools is in focus on your development machine and your Android homescreen is showing. In other words, sometimes the prompt doesn't show up when your Android or development machine screens are locked.
  • Updating the display settings for your Android device and development machine so that they never go to sleep.
  • Setting Android's USB mode to PTP. See Galaxy S4 does not show Authorize USB debugging dialog box.
  • Select Revoke USB Debugging Authorizations from the Developer Options screen on your Android device to reset it to a fresh state.

If you find a solution that is not mentioned in this section or in Chrome DevTools Devices does not detect device when plugged in, please add an answer to that Stack Overflow question, or open an issue in the webfundamentals repository!

Step 2: Debug content on your Android device from your development machine

  1. Open Chrome on your Android device.
  2. In the Remote Devices tab, click the tab that matches your Android device model name. At the top of this page, you see your Android device's model name, followed by its serial number. Below that, you can see the version of Chrome that's running on the device, with the version number in parentheses. Each open Chrome tab gets its own section. You can interact with that tab from this section. If there are any apps using WebView, you see a section for each of those apps, too. In Figure 5 there are no tabs or WebViews open.

    A connected remote device.
    Figure 5. A connected remote device

  3. In the New tab text box, enter a URL and then click Open. The page opens in a new tab on your Android device.

  4. Click Inspect next to the URL that you just opened. A new DevTools instance opens. The version of Chrome running on your Android device determines the version of DevTools that opens on your development machine. So, if your Android device is running a very old version of Chrome, the DevTools instance may look very different than what you're used to.

More actions: reload, focus, or close a tab

Click More Options More Options next to the tab that you want to reload, focus, or close.

The menu for reloading, focusing, or closing a tab.
Figure 6. The menu for reloading, focusing, or closing a tab

Inspect elements

Go to the Elements panel of your DevTools instance, and hover over an element to highlight it in the viewport of your Android device.

You can also tap an element on your Android device screen to select it in the Elements panel. Click Select Element Select
Element on your DevTools instance, and then tap the element on your Android device screen. Note that Select Element is disabled after the first touch, so you need to re-enable it every time you want to use this feature.

Screencast your Android screen to your development machine

Click Toggle Screencast Toggle Screencast to view the content of your Android device in your DevTools instance.

You can interact with the screencast in multiple ways:

  • Clicks are translated into taps, firing proper touch events on the device.
  • Keystrokes on your computer are sent to the device.
  • To simulate a pinch gesture, hold Shift while dragging.
  • To scroll, use your trackpad or mouse wheel, or fling with your mouse pointer.

Some notes on screencasts:

  • Screencasts only display page content. Transparent portions of the screencast represent device interfaces, such as the Chrome address bar, the Android status bar, or the Android keyboard.
  • Screencasts negatively affect frame rates. Disable screencasting while measuring scrolls or animations to get a more accurate picture of your page's performance.
  • If your Android device screen locks, the content of your screencast disappears. Unlock your Android device screen to automatically resume the screencast.

Feedback

Was this page helpful?
Yes
What was the best thing about this page?
It helped me complete my goal(s)
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It had the information I needed
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It had accurate information
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It was easy to read
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
Something else
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
No
What was the worst thing about this page?
It didn't help me complete my goal(s)
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It was missing information I needed
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It had inaccurate information
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It was hard to read
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
Something else
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.